package com.wpw.dream.thread;

import java.lang.Thread.UncaughtExceptionHandler;

public class ThreadException {

	public static void main(String[] args) {
		Task task = new Task();
		Thread thread = new Thread(task);
		thread.setUncaughtExceptionHandler(new ExceptionHandler());
		thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
		thread.start();
	}
}

class Task implements Runnable {
	@Override
	public void run() {
		int numero = Integer.parseInt("TTT");
		System.out.println("end...");
	}
}

class ExceptionHandler implements UncaughtExceptionHandler {
	public void uncaughtException(Thread t, Throwable e) {
		System.out.println("uncaughtException");
	}
}

class DefaultExceptionHandler implements UncaughtExceptionHandler {
	public void uncaughtException(Thread t, Throwable e) {
		System.out.println("DefaultExceptionHandler");
	}
}